package com.example.springboottestgit.service.instruction.stage1;

import com.example.springboottestgit.bean.InstructData;
import com.example.springboottestgit.common.RunNum;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

/**
 * @description:招标文件的质疑时效期
 * @author: ZZZ
 */
@Service
public class ZbQueryPeriod {
    static int n = 0;

    public List<InstructData> getInstructData() {
        List<InstructData> list = new ArrayList<>();
        for (int i = 1; i <= RunNum.a; i++) {
            list.add(mul(i % 2 == 0));
        }
        return list;
    }

    //招标文件的质疑时效期
    public InstructData mul(Boolean b) {
        Random random = new Random();
        //Boolean b = random.nextBoolean();
        int x = 7;
        if (b == true) {
            //x = random.nextInt(30) + 1;
            n++;
            x = n;
            if (n == 31) {
                n = 0;
                x = 7;
            }
        }

        String sign = x == 7 ? "符合" : "不符合";
        String e = x == 7 ? "等于" : "不等于";
        String r = x == 7 ? "对的" : "错误的";


        String instruction = "招标文件质疑时效期应在依法获取招标文件之日起x个工作日内提出是否符合法律法规";
        String input = "";
        String output = "#。根据《中华人民共和国政府采购法》第五十二条，供应商认为采购文件、采购过程和中标、成交结果使自己的权益受到损害的，可以在知道或者应知其权益受到损害之日起7个工作日内提出质疑，因此案例招标文件质疑时效期应在依法获取招标文件之日起x个工作日内提出#法律法规";

        instruction = instruction.replace("x", x + "");
        output = output.replace("x", x + "").replace("#", sign + "").replace("e", e + "").replace("r", r + "");

        InstructData instructData = new InstructData();
        instructData.setInstruction(instruction);
        instructData.setInput("");
        instructData.setOutput(output);
        return instructData;
    }
}
